$(document).ready(function($){
	$('form').submit(function(){
		var field     = $('.nr-text',this), URL = field.val();
		var hasScheme = ( URL.indexOf( 'http://' ) === 0 || URL.indexOf( 'https://' ) === 0 );
		var isFBURL   = ( URL.indexOf( 'facebook.com' ) !== -1 );
		$('.hidden-input-for-unsanitized').val(URL);
		if ( URL && !hasScheme && !isFBURL ) {
			URL = 'http://www.facebook.com/'+URL;
		} else if ( URL && isFBURL && URL.indexOf( 'www.facebook.com' ) === -1 ) {
			URL = URL.replace( 'facebook.com', 'www.facebook.com' );
		} else if ( URL && !hasScheme ) {
			URL = 'http://'+URL;
		}
		field.val(URL);
		return ( URL != '' );
	});
});